package com.ygxsk.carhome.ui.archive;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.flyco.roundview.RoundTextView;
import com.gyf.immersionbar.ImmersionBar;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.XXPermissions;
import com.hjq.toast.Toaster;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.alertview.AlertView;
import com.ygxsk.carhome.alertview.OnItemClickListener;
import com.ygxsk.carhome.configeng.GifSizeFilter;
import com.ygxsk.carhome.configeng.Glide4Engine;
import com.ygxsk.carhome.constant.ConstantApi;
import com.ygxsk.carhome.constant.ConstantSign;
import com.ygxsk.carhome.constant.ExtraKey;
import com.ygxsk.carhome.constant.ExtraValue;
import com.ygxsk.carhome.enumwrap.ArchiveUpdateType;
import com.ygxsk.carhome.event.EventAgreeMentDetail;
import com.ygxsk.carhome.event.EventArchiveDetail;
import com.ygxsk.carhome.listener.AuthorityCallbackListener;
import com.ygxsk.carhome.listener.DoSomeThingListener;
import com.ygxsk.carhome.listener.ErrorParentExtraSingle;
import com.ygxsk.carhome.listener.GainDataCallBackListener;
import com.ygxsk.carhome.listener.RxBus;
import com.ygxsk.carhome.permission.PermissionSetting;
import com.ygxsk.carhome.permission.RuntimeRationale;
import com.ygxsk.carhome.response.ArchiveType;
import com.ygxsk.carhome.response.ArchivesManageFileVo;
import com.ygxsk.carhome.response.ArchivesManageVo;
import com.ygxsk.carhome.response.EvaluateWadeInfo;
import com.ygxsk.carhome.response.FileSingleUpLoadBean;
import com.ygxsk.carhome.response.FileUpLoad;
import com.ygxsk.carhome.response.InformationManage;
import com.ygxsk.carhome.retrofit.AddLogUpLoadInfo;
import com.ygxsk.carhome.retrofit.ApiException;
import com.ygxsk.carhome.retrofit.ApiRequestSubListener;
import com.ygxsk.carhome.retrofit.ApiService;
import com.ygxsk.carhome.retrofit.ErrorConsumer;
import com.ygxsk.carhome.retrofit.NetworkManager;
import com.ygxsk.carhome.retrofit.ResponseTransformer;
import com.ygxsk.carhome.rxbus.RxBusCalendarTimeForAgreement;
import com.ygxsk.carhome.rxbus.RxBusCarWadeForAgreement;
import com.ygxsk.carhome.sys.PermissionNameConvert;
import com.ygxsk.carhome.ui.ErrorActivity;
import com.ygxsk.carhome.ui.evaluate.CalendarViewCustomPopup;
import com.ygxsk.carhome.ui.evaluate.EvaluateWadePopu;
import com.ygxsk.carhome.utils.CommUtils;
import com.ygxsk.carhome.views.ClearEditText;
import com.ygxsk.integrated.retrofit.Parameterkey;
import com.zhongjh.albumcamerarecorder.album.filter.BaseFilter;
import com.zhongjh.albumcamerarecorder.preview.BasePreviewActivity;
import com.zhongjh.albumcamerarecorder.settings.AlbumSetting;
import com.zhongjh.albumcamerarecorder.settings.CameraSetting;
import com.zhongjh.albumcamerarecorder.settings.GlobalSetting;
import com.zhongjh.albumcamerarecorder.settings.MultiMediaSetting;
import com.zhongjh.common.entity.LocalFile;
import com.zhongjh.common.entity.MultiMedia;
import com.zhongjh.common.entity.SaveStrategy;
import com.zhongjh.common.enums.MimeType;
import com.zhongjh.progresslibrary.entity.MultiMediaView;
import com.zhongjh.progresslibrary.listener.MaskProgressLayoutListener;
import com.zhongjh.progresslibrary.widget.MaskProgressLayout;

import org.greenrobot.eventbus.EventBus;

import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023-07-27  20:50
 * @Description:单独的一个合同的添加
 */
public class AgreenMentAddSubmitActivity extends ErrorActivity implements ErrorParentExtraSingle {

    protected static final int REQUEST_CODE_CHOOSE = 2361;

    @BindView(R.id.layoutbuttonfileaddsubmit)
    RoundTextView layoutButtonFileAddSubmit;

    //选择合同类型外侧包裹
    @BindView(R.id.layoutfileagreenname)
    LinearLayout layoutFileAgreenName;

    //合同的那个类型名称
    @BindView(R.id.textviewfileagreenname)
    TextView textViewFileAgreenName;

    //选择合同签约时间 外侧包裹
    @BindView(R.id.layoutagreentimeoutside)
    LinearLayout layoutAgreenTimeOutside;

    //合同签约时间
    @BindView(R.id.textviewagreentime)
    TextView textViewAgreenTime;

    //签约人的姓名
    @BindView(R.id.editviewnameagreen)
    ClearEditText editViewNameAgreen;

    //合同金额
    @BindView(R.id.editviewpriceamount)
    ClearEditText editViewPriceAmount;

    @BindView(R.id.mplimagelistinagreenment)
    MaskProgressLayout mplimageListInAgreenMent;

    //选择认证体系的 底部弹窗；
    private BasePopupView basePopupView_agreeMentType;
    //弹窗关于签约时间的
    private BasePopupView basePopupViewAgreenmentTime;

    //合同类型id
    private String archiveTypeId_upLoad;
    //选中的签约时间
    private String signingDate_upLoad;
    //签约人
    private String partyA_upLoad;
    //合同金额
    private String amount_upLoad;

    //这条车辆档案的id,  档案盒子的id
    private String informationId_upLoad;
//    private String vehicleId_upLoad;

    //添加是 是从 编辑 单个合同 过来的；
    private boolean extra_archivesmanage_vo_is_edit;

    //小范畴的，单个合同的 id
    private String archivesId_upLoad;

    //这条从详情遍历出来的数据，不是携带的，因为有继承关系，不能序列化，
    private ArchivesManageVo archivesManageVo_outSide;

    //一个临时的客户来源的列表；
//  private ArrayList<AgreenMentTypeBean> datas_auth_system = new ArrayList<>();

    //一个临时的车系内容
    private ArrayList<EvaluateWadeInfo> mDataResources_archiveTypeList_forPopu = new ArrayList<>();
    //做上传图片的记录
    private ArrayList<HashMap<String, Object>> fileSingleUpLoadFiles_upLoad_hashMap = new ArrayList<>();

    //添加该页面的设置内容；
    private GlobalSetting mGlobalSetting;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityInstance = this;

        if (fileSingleUpLoadFiles_upLoad_hashMap == null) {
            fileSingleUpLoadFiles_upLoad_hashMap = new ArrayList<>();
        }

        if (mDataResources_archiveTypeList_forPopu == null) {
            mDataResources_archiveTypeList_forPopu = new ArrayList<>();
        }

        processExtraData();

        initConfig();

        initViews();

        gainDatas();

        mCompositeDisposable.add(RxBus.getInstance()
                .toObserverable(RxBusCarWadeForAgreement.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusCarWadeForAgreement>() {

                    @Override
                    public void accept(RxBusCarWadeForAgreement rxBusCarWadeForAgreement) throws Throwable {

                        if (rxBusCarWadeForAgreement != null) {

                            if (rxBusCarWadeForAgreement.getActionFlag() == ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TYPE_SELECT) {//选择合同的类型；

                                //类型的id
                                archiveTypeId_upLoad = rxBusCarWadeForAgreement.getEvaluateWadeInfo().getDictCode();
                                //类型的文本
                                String archiveTypeInfo_upLoad = rxBusCarWadeForAgreement.getEvaluateWadeInfo().getDictLabel();

                                //修改文本值
                                if (textViewFileAgreenName != null) {
                                    textViewFileAgreenName.setText(archiveTypeInfo_upLoad);
                                }

                                //判断用户有没有选中信息若
                            }
                        }
                    }
                }));

        //监听选中的签约时间
        mCompositeDisposable.add(RxBus.getInstance()
                .toObserverable(RxBusCalendarTimeForAgreement.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusCalendarTimeForAgreement>() {

                    @Override
                    public void accept(RxBusCalendarTimeForAgreement rxBusCalendarTimeForAgreement) throws Throwable {

                        if (rxBusCalendarTimeForAgreement != null) {

                            if (rxBusCalendarTimeForAgreement.getActionFlag() == ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TIME_SELECT) {

                                //【筛选是签约时间】；
                                signingDate_upLoad = rxBusCalendarTimeForAgreement.getManufactureDate();
//                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "选中的签约时间 agreeMentTimeSelect-->" + signingDate_upLoad);

                                //判断适配器，从适配器之中取值textView赋值
                                if (textViewAgreenTime != null) {
                                    textViewAgreenTime.setText(rxBusCalendarTimeForAgreement.getManufactureDate());
                                }

                            }
                        }
                    }
                }));


    }

    private void initConfig() {

        // 拍摄有关设置
        CameraSetting cameraSetting = new CameraSetting();
        // 支持的类型：图片，视频
        cameraSetting.mimeTypeSet(MimeType.ofImage());
        // 相册
        AlbumSetting albumSetting = new AlbumSetting(true);
        albumSetting.mimeTypeSet(MimeType.ofImage());
        albumSetting.showSingleMediaType(true);
        albumSetting.countable(true);
        albumSetting.addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K));
        albumSetting.gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size));
        albumSetting.thumbnailScale(0.85f);
        albumSetting.setOnSelectedListener(localFiles -> {
            // 每次选择的事件
//                    LogUtils.d("itchen---onSelected", "onSelected: localFiles.size()=" + localFiles.size());
        });
        albumSetting.originalEnable(true);
        albumSetting.maxOriginalSize(1);
        albumSetting.setOnCheckedListener(isChecked -> {
            // 是否勾选了原图
//                    LogUtils.d("itchen----isChecked", "onCheck: isChecked=" + isChecked);
        });// 支持的类型：图片，视频
// 仅仅显示一个多媒体类型
// 是否显示多选图片的数字
// 自定义过滤器
// 九宫格大小
// 图片缩放比例
// 开启原图
// 最大原图size,仅当originalEnable为true的时候才有效
// 录音机
//        RecorderSetting recorderSetting = new RecorderSetting();

        // 全局
        mGlobalSetting = MultiMediaSetting.from(AgreenMentAddSubmitActivity.this)
                .choose(MimeType.ofImage())
                .albumSetting(albumSetting)
                .cameraSetting(cameraSetting)
                .isImageEdit(false)//不编辑图片
//                .recorderSetting(recorderSetting)
                // 设置路径和7.0保护路径等等 com.ygxsk.carhome.fileprovider
                .allStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, ConstantSign.FILE_PROVIDER_AA_TEST))//"AA/test"
                // 如果设置这个，有关图片的优先权比allStrategy高
                .pictureStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, ConstantSign.FILE_PROVIDER_AA_PICTURE))//AA/picture
                // 如果设置这个，有关音频的优先权比allStrategy高
                //.audioStrategy(new SaveStrategy(true, "com.ygxsk.integrated.fileprovider", "AA/audio"))
                // 如果设置这个，有关视频的优先权比allStrategy高
                .videoStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, ConstantSign.FILE_PROVIDER_AA_VIDEO))//"AA/video"
                //  .imageEngine(new GlideEngine())  // for glide-V3     // for glide-V4
                .imageEngine(new Glide4Engine());

    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();

        ImmersionBar.with(this)//
                .titleBar(R.id.toolbarygxskout)
                .fitsSystemWindows(true)//解决状态栏和布局重叠问题，任选其一，默认为false，当为true时一定要指定statusBarColor()，不然状态栏为透明色，还有一些重载方法
                //.statusBarColor(R.color.colorPrimary)//
                //.navigationBarColor(R.color.colorPrimary)//
                //.keyboardEnable(true)
                .init();
    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_agreen_ment_add_submit;
    }

    @Override
    protected void initToolBar(ToolbarHelper toolbarHelper) {

        Bundle extras_bundle = this.getIntent().getExtras();
        extra_archivesmanage_vo_is_edit = extras_bundle.getBoolean(ExtraKey.EXTRA_ARCHIVESMANAGE_VO_IS_EDIT);

        if (extra_archivesmanage_vo_is_edit) {
            toolbarHelper.setTitle(getString(R.string.change_submit_agreement));
        } else {
            toolbarHelper.setTitle(getString(R.string.add_submit_agreement));
        }

        toolbarHelper.setVersionName(true, AppUtils.getAppVersionName());
        toolbarHelper.setLayoutClose(false, "", null);

        toolbarHelper.setLayoutLeft(true, R.drawable.backicon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //搜索客户信息，优先关闭软键盘
                KeyboardUtils.hideSoftInput(mActivityInstance);
                methodBack();
            }
        });

        toolbarHelper.setLayoutRight(false, 0, "", null);

    }

    @Override
    protected void onClickNodata(View v) {

        //retain

    }

    @Override
    protected void initViews() {

        //点击底部的保存按钮
        if (layoutButtonFileAddSubmit != null) {

            layoutButtonFileAddSubmit.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    KeyboardUtils.hideSoftInput(mActivityInstance);

                    //签约人
                    partyA_upLoad = editViewNameAgreen.getText().toString().trim();
                    //合同金额
                    amount_upLoad = editViewPriceAmount.getText().toString().trim();

                    //时间重新赋值一次
                    if (TextUtils.isEmpty(signingDate_upLoad)) {
                        signingDate_upLoad = textViewAgreenTime.getText().toString().trim();
                    }

                    //校验 合同类型
                    if (TextUtils.isEmpty(archiveTypeId_upLoad)) {
                        //选择时间异常，请重新选择；
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.please_choose_agreen_type), true);
                        mAlertView.show();
                        return;
                    }

                    //校验签约时间
                    if (TextUtils.isEmpty(signingDate_upLoad)) {
                        //选择时间异常，请重新选择；
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.timeisnullchoosesubmit), true);
                        mAlertView.show();
                        return;
                    }

                    //校验签约人
                    if (TextUtils.isEmpty(partyA_upLoad)) {
                        //选择时间异常，请重新选择；
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.must_input_patya), true);
                        mAlertView.show();
                        return;
                    }

                    //校验合同金额
                    if (TextUtils.isEmpty(amount_upLoad)) {
                        //选择时间异常，请重新选择；
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.must_input_agreement_amount), true);
                        mAlertView.show();
                        return;
                    }

                    //校验合同附件
                    if (fileSingleUpLoadFiles_upLoad_hashMap != null && fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.must_input_agreement_files), true);
                        mAlertView.show();
                        return;
                    }

                    //上传合同的附件
                    ArrayList<ArchivesManageFileVo> archivesManageFileVoList = new ArrayList<>();

                    //直接过滤图片的信息
                    if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {

                        for (HashMap<String, Object> hashMapItem : fileSingleUpLoadFiles_upLoad_hashMap) {

//                            {
//                                    "file_path_local": "/storage/emulated/0/Pictures/weibo/img-1661169652148160bf0f243cf72962080bdd9e580cc89c3c9e5b0cbf4934dcff715d19c644ad3.jpg",
//                                    "file_name": "img-1661169652148160bf0f243cf72962080bdd9e580cc89c3c9e5b0cbf4934dcff715d19c644ad3.jpg",
//                                    "file_path_server": "null/20230819/2023081914514109328330.jpg",
//                                    "file_url_server": "http://222.222.17.184:8990/resource/null/20230819/2023081914514109328330.jpg",
//                                    "file_upload": {
//                                    "filePath": "null/20230819/2023081914514109328330.jpg"
//                              }
//                            }

                            ArchivesManageFileVo archivesManageFileVo = new ArchivesManageFileVo();

                            String imageServerPath = (String) hashMapItem.get(Parameterkey.file_path_server);

                            if (!TextUtils.isEmpty(imageServerPath)) {

                                //是修改用到：
                                archivesManageFileVo.setFileId((String) hashMapItem.get(Parameterkey.fileId));
                                archivesManageFileVo.setFilePath(imageServerPath);
                                archivesManageFileVo.setUrl((String) hashMapItem.get(Parameterkey.file_url_server));

                                archivesManageFileVoList.add(archivesManageFileVo);
                            }

                        }

                        //即将提交的图片内容是
                        for (ArchivesManageFileVo archivesManageFileVo : archivesManageFileVoList) {
                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将上传 archivesManageFileVo", archivesManageFileVo);
                        }

                    } else {
                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "itchen---->添加报修的图片地址 fileSingleUpLoadFiles_upLoad_hashMap 是空的");
                    }

                    //直接添加上传信息
                    CommUtils.checkDialog(mAlertView);
                    mAlertView = new AlertView(StringUtils.getString(R.string.clearaddorsubmitsuretitletips), //提示
                            StringUtils.getString(R.string.clearaddorsubmitsuremessage),//提示内容
                            StringUtils.getString(R.string.clearcachecancel), //取消
                            new String[]{StringUtils.getString(R.string.clearaddorsubmitsure)},//确定
                            null, mActivityInstance, AlertView.Style.Alert, new OnItemClickListener() {//
                        @Override
                        public void onItemClick(Object o, int position) {

                            if (position != AlertView.CANCELPOSITION) {

                                if (extra_archivesmanage_vo_is_edit) {
                                    method_agreement_single_modify_upLoad(archivesManageFileVoList);
                                } else {
                                    method_agreement_single_upLoad(archivesManageFileVoList);
                                }

                            }
                        }
                    });

                    mAlertView.setCancelable(true);
                    mAlertView.show();

                }
            });
        }

        //弹窗合同类型
        if (layoutFileAgreenName != null) {

            layoutFileAgreenName.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    //弹出合同类型的选择弹窗
                    KeyboardUtils.hideSoftInput(mActivityInstance);

                    EvaluateWadePopu evaluateWadePopu = new EvaluateWadePopu(AgreenMentAddSubmitActivity.this,//
                            ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TYPE_SELECT,//
                            mDataResources_archiveTypeList_forPopu);

                    evaluateWadePopu.setTitleName(getResources().getString(R.string.please_choose_agreen_type));

                    basePopupView_agreeMentType = new XPopup.Builder(AgreenMentAddSubmitActivity.this)
                            .hasShadowBg(true)
                            .isViewMode(true)
                            .asCustom(evaluateWadePopu)//
                            .show();

                }
            });
        }

        //时间选择器-监听合同签订时间
        if (layoutAgreenTimeOutside != null) {

            layoutAgreenTimeOutside.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    KeyboardUtils.hideSoftInput(mActivityInstance);

                    CalendarViewCustomPopup calendarViewCustomPopup = new CalendarViewCustomPopup(ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TIME_SELECT,
                            1,
                            AgreenMentAddSubmitActivity.this, false);

                    basePopupViewAgreenmentTime = new XPopup.Builder(AgreenMentAddSubmitActivity.this)
                            .hasShadowBg(true)
                            .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面
                            .isViewMode(true)
                            .isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                            .isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                            .asCustom(calendarViewCustomPopup)
                            .show();

                }
            });

        }

        //处理图片选择器
        if (mplimageListInAgreenMent != null) {
            mplimageListInAgreenMent.setMaskProgressLayoutListener(new MaskProgressLayoutListener() {
                @Override
                public void onItemAdd(@NonNull View view, @NonNull MultiMediaView multiMediaView,
                                      int alreadyImageCount,//
                                      int alreadyVideoCount, //
                                      int alreadyAudioCount) {

                    try {


                        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {

                            //do
                            //添加权限提示，人为的提示；
                            if (!AndPermission.hasPermissions(mActivityInstance, Permission.CAMERA)//
                                    || !AndPermission.hasPermissions(mActivityInstance, Permission.WRITE_EXTERNAL_STORAGE)//
                                    || !AndPermission.hasPermissions(mActivityInstance, Permission.READ_EXTERNAL_STORAGE)//
                            ) {//

                                CommUtils.checkMaterialDialog(materialDialog);

                                materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                                    @Override
                                    public void doSomeThing() {

                                        //添加访问权限内容
                                        AndPermission.with(AgreenMentAddSubmitActivity.this)
                                                .runtime()//
                                                .permission(Permission.CAMERA,//
                                                        Permission.READ_EXTERNAL_STORAGE, //
                                                        Permission.WRITE_EXTERNAL_STORAGE//
                                                )//
                                                .rationale(new RuntimeRationale())//
                                                .onGranted(new com.yanzhenjie.permission.Action<List<String>>() {
                                                    @Override
                                                    public void onAction(List<String> permissions) {

                                                        //直接的执行,仅仅拍照+录视频
                                                        openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                                                    }
                                                }).onDenied(new com.yanzhenjie.permission.Action<List<String>>() {
                                                    @Override
                                                    public void onAction(List<String> permissions) {

                                                        ToastUtils.showShort(ConstantSign.NEEDPERMISS_PHONE);

                                                        PermissionSetting permissionSetting = new PermissionSetting(mActivityInstance);
                                                        if (AndPermission.hasAlwaysDeniedPermission(AgreenMentAddSubmitActivity.this, permissions)) {
                                                            permissionSetting.showSetting(ConstantApi.PERMISSION_NORMAL, AgreenMentAddSubmitActivity.this, permissions);
                                                        }

                                                    }
                                                }).start();

                                        CommUtils.checkMaterialDialog(materialDialog);

                                    }
                                });

                            } else {

//                               LogUtils.d(ConstantSign.LOGCAT_NOMAL + "正常的权限已经打开，可以执行拍照操作");
                                //直接的执行,仅仅拍照+录视频
                                openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                            }


                        } else {

                            //大于或等于android 13
                            // public static final String READ_MEDIA_AUDIO = "android.permission.READ_MEDIA_AUDIO";
//                        public static final String READ_MEDIA_IMAGES = "android.permission.READ_MEDIA_IMAGES";
//                        public static final String READ_MEDIA_VIDEO = "android.permission.READ_MEDIA_VIDEO";

                            //首次添加的添加按钮
                            //添加权限提示，人为的提示；
                            if (!XXPermissions.isGranted(mActivityInstance, com.hjq.permissions.Permission.CAMERA)//
                                    || !XXPermissions.isGranted(mActivityInstance, com.hjq.permissions.Permission.READ_MEDIA_IMAGES)) {

                                CommUtils.checkMaterialDialog(materialDialog);
                                materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                                    @Override
                                    public void doSomeThing() {

                                        XXPermissions.with(AgreenMentAddSubmitActivity.this)
                                                // 适配分区存储应该这样写
                                                //.permission(Permission.Group.STORAGE)
                                                // 不适配分区存储应该这样写
                                                .permission(com.hjq.permissions.Permission.CAMERA)//
                                                .permission(com.hjq.permissions.Permission.READ_MEDIA_IMAGES)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_VIDEO)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_AUDIO)//
                                                //).permission(com.hjq.permissions.Permission.MANAGE_EXTERNAL_STORAGE
//                                                        .interceptor(new PermissionInterceptor())
                                                .request(new OnPermissionCallback() {

                                                    @Override
                                                    public void onGranted(@NonNull List<String> permissions, boolean allGranted) {

                                                        if (!allGranted) {
                                                            // TODO: 2024/1/23 18:50 权限这里要不要给提示？权限没通过

                                                            return;
                                                        }

                                                        Toaster.show(String.format(getString(R.string.demo_obtain_permission_success_hint),
                                                                PermissionNameConvert.getPermissionString(AgreenMentAddSubmitActivity.this, permissions)));

                                                        openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                                                    }
                                                });

                                        CommUtils.checkMaterialDialog(materialDialog);

                                    }
                                });

                            } else {

//                              LogUtils.d(ConstantSign.LOGCAT_NOMAL + "正常的权限已经打开，可以执行拍照操作");
                                //直接的执行,仅仅拍照+录视频
                                openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);
                            }

                        }


                    } catch (Exception e) {
                        //catch
                        e.printStackTrace();
                    }

                }

                @Override
                public void onItemClick(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

                    try {
                        //do
                        if (multiMediaView.isImageOrGif() || multiMediaView.isVideo()) {//

                            if (mplimageListInAgreenMent != null) {

                                if (mGlobalSetting != null) {

                                    mGlobalSetting.openPreviewData(AgreenMentAddSubmitActivity.this, REQUEST_CODE_CHOOSE,
                                            mplimageListInAgreenMent.getImagesAndVideos(),//
                                            mplimageListInAgreenMent.getImagesAndVideos().//
                                                    indexOf(multiMediaView));//
                                } else {
                                    ToastUtils.showShort(StringUtils.getString(R.string.globalsettingnull));
                                }
                            }

                        }

                    } catch (Exception e) {
                        //catch
                        e.printStackTrace();
                    }

                }

                @Override
                public void onItemStartUploading(@NonNull MultiMediaView multiMediaView) {

                }

                @Override
                public void onItemClose(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

                    //对图片的编辑；
                    try {

                        //do
                        if (multiMediaView != null) {

                            //是否要区分：是【添加图片】还是【从详情里取到的图片】
                            //filepath有可能是空的，但是
//                            {
//                                    "file_path_server": "null/20230818/2023081816385668841893.jpg",
//                                    "file_url_server": "http://222.222.17.184:8990/resource/null/20230818/2023081816385668841893.jpg"
//                            }

//                            {
//                                    "file_path_local": "/storage/emulated/0/DCIM/Camera/IMG_20230723_084352.jpg",
//                                    "file_name": "IMG_20230723_084352.jpg",
//                                    "file_path_server": "null/20230829/2023082910243621252656_750x750.jpg",
//                                    "file_url_server": "http://222.222.17.184:8990/resource/null/20230829/2023082910243621252656_750x750.jpg",
//                                    "file_upload": {
//                                    "filePath": "null/20230829/2023082910243621252656_750x750.jpg"
//                            }

                            //是否要区分：是【添加图片】还是【从详情里取到的图片】
                            String filePath = multiMediaView.getPath();
                            String file_url_server = multiMediaView.getUrl();
                            //--------------------------------------------------------------------------
                            //LogUtils.d(ConstantSign.LOGCAT_NOMAL + "---filePath-->" + filePath);
                            //itchen-->---filePath-->/storage/emulated/0/middlelow/IMAGE_20230512_173801068.jpg

                            if (!TextUtils.isEmpty(filePath)) {
                                String getCurrentFileShortName = CommUtils.valueStringSplit(filePath);
                                if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
                                    //遍历循环装载HashMap的list
                                    Iterator<HashMap<String, Object>> iterator = fileSingleUpLoadFiles_upLoad_hashMap.iterator();
                                    if (iterator != null) {
                                        while (iterator.hasNext()) {
                                            HashMap<String, Object> hashMapItem = iterator.next();
                                            if (hashMapItem != null) {
                                                String file_short_name_local = (String) hashMapItem.get(Parameterkey.file_name);
                                                if (!TextUtils.isEmpty(getCurrentFileShortName) && !TextUtils.isEmpty(file_short_name_local)) {
                                                    if (TextUtils.equals(getCurrentFileShortName, file_short_name_local)) {
                                                        fileSingleUpLoadFiles_upLoad_hashMap.remove(hashMapItem);
                                                        LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将删除---本地数据-hashMapItem-->", hashMapItem);
                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            //--------------------------------------------------------------------------
                            //从服务器加载的，本地肯定是空值；
                            // : 2023-08-30 10:16 添加在线加载的图片的路径
                            if (!TextUtils.isEmpty(file_url_server)) {
                                String getCurrentFileShortName = CommUtils.valueStringSplit(file_url_server);
                                if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
                                    //遍历循环装载HashMap的list
                                    Iterator<HashMap<String, Object>> iterator = fileSingleUpLoadFiles_upLoad_hashMap.iterator();
                                    if (iterator != null) {
                                        while (iterator.hasNext()) {
                                            HashMap<String, Object> hashMapItem = iterator.next();
                                            if (hashMapItem != null) {
                                                String file_short_name_server = (String) hashMapItem.get(Parameterkey.file_name);
                                                if (!TextUtils.isEmpty(getCurrentFileShortName) && !TextUtils.isEmpty(file_short_name_server)) {
                                                    if (TextUtils.equals(getCurrentFileShortName, file_short_name_server)) {
                                                        fileSingleUpLoadFiles_upLoad_hashMap.remove(hashMapItem);
                                                        LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将删除---在线获取的--hashMapItem-->", hashMapItem);
                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            //--------------------------------------------------------------------------


                        }

                    } catch (Exception e) {
                        //catch
                        e.printStackTrace();
                    }


                }

                @Override
                public void onItemAudioStartDownload(@NonNull View view, @NonNull String s) {

                }

                @Override
                public boolean onItemVideoStartDownload(@NonNull View view, @NonNull MultiMediaView multiMediaView) {
                    return false;
                }

                @Override
                public void onAddDataSuccess(@NonNull List<MultiMediaView> list) {

                }
            });

        }

    }

    /**
     * 公共的打开多媒体事件
     *
     * @param alreadyImageCount 已经存在的图片
     * @param alreadyVideoCount 已经存在的语音
     * @param alreadyAudioCount 已经存在的视频
     */
    private void openMain(int alreadyImageCount, int alreadyVideoCount, int alreadyAudioCount) {

        // 拍摄有关设置
        CameraSetting cameraSetting = new CameraSetting();
        // 支持的类型：图片，视频
        //cameraSetting.mimeTypeSet(MimeType.ofAll());
        cameraSetting.mimeTypeSet(MimeType.ofImage());

        // 相册
        AlbumSetting albumSetting = new AlbumSetting(false)
                // 支持的类型：图片，视频
                .mimeTypeSet(MimeType.ofImage())
                // 是否显示多选图片的数字
                .countable(true)
                // 自定义过滤器
                .addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K))
                // 开启原图
                .originalEnable(true)
                // 最大原图size,仅当originalEnable为true的时候才有效
                .maxOriginalSize(ConstantApi.MAX_IMAGE_SELECTABLE);

        // 录音机
        //RecorderSetting recorderSetting = new RecorderSetting();

        // 全局
        mGlobalSetting = MultiMediaSetting.from(AgreenMentAddSubmitActivity.this).choose(MimeType.ofImage());
        mGlobalSetting.albumSetting(albumSetting);
        mGlobalSetting.isImageEdit(false);

//        if (mBinding.cbAlbum.isChecked()) {
//            // 开启相册功能
//            mGlobalSetting.albumSetting(albumSetting);
//        }

        // 开启拍摄功能
        mGlobalSetting.cameraSetting(cameraSetting);

//        if (mBinding.cbRecorder.isChecked()) {
//            // 开启录音功能
//            mGlobalSetting.recorderSetting(recorderSetting);
//        }

        mGlobalSetting
                // 设置路径和7.0保护路径等等
                .allStrategy(new SaveStrategy(true,//
                        ConstantSign.FILE_PROVIDER, //fileProvider
                        ConstantSign.FOLDER_MIDDLELOW))//
                // for glide-V4
                .imageEngine(new Glide4Engine())
                // 最大5张图片、最大3个视频、最大1个音频
                .maxSelectablePerMediaType(null,
                        ConstantApi.MAX_IMAGE_SELECTABLE,//整体设置；
                        ConstantApi.MAX_VIDEO_SELECTABLE,
                        ConstantApi.MAX_AUDIO_SELECTABLE,
                        alreadyImageCount,
                        alreadyVideoCount,
                        alreadyAudioCount)
                .forResult(REQUEST_CODE_CHOOSE);
    }


    @Override
    protected void gainDatas() {

        if (NetworkUtils.isConnected()) {

            //获取车辆品牌+车系
            //获取车辆的品牌信息
//            gainCarBrandLargeCategory(null);
//            gainCarBrandSeriesLineSmallCategory();

            //获取合同类型
            gainContractType(null);

            //如果是【编辑】过来的，那么需要【先获取合同详情】；
            if (extra_archivesmanage_vo_is_edit) {

                gainDetailDatas();

            }


        } else {
            ToastUtils.showShort(StringUtils.getString(R.string.http_exception_network));
        }

    }

    //获取单个-单个合同的详情；
    private void gainDetailDatas() {

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.key, archivesId_upLoad);

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_ARCHIVESMANAGE_GETBYID_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.addInformationManage_getById_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .archivesmanage_getById(archivesId_upLoad)
                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArchivesManageVo>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                        //这里也是遮盖信息
//                      methodNotSuccessData(what_method, serverCode, serverMessage);

                        CommUtils.checkMaterialDialog(materialDialog);
                        if (!TextUtils.isEmpty(serverMessage)) {
                            ToastUtils.showShort(serverMessage);
                        }

                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {
                        method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        loadingGone();
                    }
                }).subscribe(new Consumer<ArchivesManageVo>() {
                    @Override
                    public void accept(ArchivesManageVo archivesManageVo) throws Throwable {
                        CommUtils.checkMaterialDialog(materialDialog);

                        if (archivesManageVo != null) {

                            //重新赋值一次，主要用于【编辑合同】
                            archivesManageVo_outSide = archivesManageVo;

                            //直接加载详情;
                            method_handler_detail(archivesManageVo);

                            //--------------------------------------------------------------------------------------------------------------------------------
                            //预备合同信息-合同列表信息
//                            ArrayList<ArchivesManageVo> archivesManageList = (ArrayList<ArchivesManageVo>) informationManageVo.getArchivesManageList();
//                            if (archivesManageList != null && !archivesManageList.isEmpty()) {
//                                for (ArchivesManageVo archivesManageVo : archivesManageList) {
//                                    //重新组织合同信息;
//                                    String archivesId = archivesManageVo.getArchivesId();
//                                    if (TextUtils.equals(extra_archivesId, archivesId)) {
//
//                                        //打印这个传递值
//                                        LogUtils.json(ConstantSign.LOGCAT_NOMAL + "-遍历的这条合同是-archivesManageVo-->", archivesManageVo);
//                                        archivesManageVo_outSide = archivesManageVo;
//
//                                        break;
//                                    }
//
//                                }
//                                //直接加载详情;
//                                method_handler_detail(archivesManageVo_outSide);
//
//                            }
                        }
                        //-----------------------------------------------------------------------------------------------------
                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {
                        //页面报错；
                        function_apiException(apiException);
                    }
                });

    }

    //单个合同的添加接口，上传 ，执行上传操作
    private void method_agreement_single_upLoad(ArrayList<ArchivesManageFileVo> _archivesManageFileVoList) {

//        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()//
//                .setType(MultipartBody.FORM);//
        //不是做上传，是为了做日志上传用的
//        ArrayList<String> addLogList = new ArrayList<>();

//        if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
//            for (HashMap<String, Object> hashMapItem : fileSingleUpLoadFiles_upLoad_hashMap) {
//
//                String imageLocalPath = (String) hashMapItem.get(Parameterkey.file_path_server);
//
//                if (!TextUtils.isEmpty(imageLocalPath)) {
//
////                    File file = new File(imageLocalPath);
////                    multipartBodyBuilder.addFormDataPart(Parameterkey.files, file.getName(),//
////                            RequestBody.create(file, MediaType.parse(ApiService.MEDIATYPE_IMAGE_JPG)));//
////                    addLogList.add(imageLocalPath);
//                }
//            }
//        } else {
//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "itchen---->添加报修的图片地址 fileSingleUpLoadFiles_upLoad_hashMap 是空的");
//        }

        //接口文档传递参数；
//        {
//               "amount": "250000",
//                "archiveNo": "",
//                "archiveTypeId": "1",
//                "archivesManageFileVoList": [
//            {
//                "filePath": "null/20230818/2023081816083899456384.jpg"
//            }
//],
//                "brandModel": "",
//                "carBrand": "",
//                "partyA": "陈琪",
//                "signingDate": "2023-08-31",
//                "vehicleId": 30
//        }

//        {
//            "amount":"123456",
//                "archiveNo":"",
//                "archiveTypeId":"1",
//                "archivesManageFileVoList":[
//            {
//                "filePath":"null/20230819/2023081915064408016637.jpg"
//            },
//            {
//                "filePath":"null/20230819/2023081915064428513555.jpg"
//            },
//            {
//                "filePath":"null/20230819/2023081915064441759318.jpg"
//            }
//	           ],
//            "brandModel":"",
//                "carBrand":"",
//                "partyA":"陈大陈",
//                "signingDate":"2023-10-26",
//                "vehicleId":null
//        }

        //仅仅做参数上传addlog用；
        HashMap<String, Object> map = new HashMap<>();
//        map.put(Parameterkey.vehicleId, vehicleId_upLoad);//车辆档案id
        map.put(Parameterkey.informationId, informationId_upLoad);//车辆档案id,外层档案盒子的id
        map.put(Parameterkey.amount, amount_upLoad);//合同金额
        map.put(Parameterkey.archiveTypeId, archiveTypeId_upLoad);//合同类型
        map.put(Parameterkey.signingDate, signingDate_upLoad);//签约时间
        map.put(Parameterkey.partyA, partyA_upLoad);//合同的签约人
        map.put(Parameterkey.archiveNo, "");//合同编号-没有填写合同编号的地方，只能填充空值；
        map.put(Parameterkey.carBrand, "");//车辆品牌
        map.put(Parameterkey.brandModel, "");//车辆-车型
        map.put(Parameterkey.archivesManageFileVoList, _archivesManageFileVoList);//仅仅做日志上传

        //将来可能用
//        map.put(Parameterkey.brandId, brandId_upLoad);//车辆品牌
//        map.put(Parameterkey.seriesId, seriesId_upLoad);//车系ID
//        map.put(Parameterkey.carName, carName_upLoad);//车型

        //============================================================================================================
        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_ADDARCHIVESMANAGE_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.addArchivesManage_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);//仅仅有提交参数的能力

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .addArchivesManage(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                        MediaType.parse(ApiService.HEADER_JSON)))
                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

                        method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);

                    }
                }).subscribe(new Consumer<String>() {
                    @Override
                    public void accept(String stringValue) throws Throwable {

                        //TipDialog.show(StringUtils.getString(R.string.add_submit_success), WaitDialog.TYPE.SUCCESS);
                        CommUtils.checkMaterialDialog(materialDialog);

                        //通知主页列表刷新
                        EventArchiveDetail eventArchiveDetail = new EventArchiveDetail();
                        eventArchiveDetail.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_ARCHIVEFILE_DETAIL);
                        EventBus.getDefault().post(eventArchiveDetail);

                        //该页面关闭，
                        //提示提交成功，然后1秒后关闭界面
                        methodSubmitSuccess(AgreenMentAddSubmitActivity.this, new DoSomeThingListener() {
                            @Override
                            public void doSomeThing() {
                                methodBack();
                            }
                        });

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        //retain
                        CommUtils.checkMaterialDialog(materialDialog);

                        if (apiException != null) {
                            if (!TextUtils.isEmpty(apiException.getDisplayMessage())) {
                                ToastUtils.showShort(apiException.getDisplayMessage());
                            }
                        }

                    }
                });

    }


    //单独的修改合同，添加的上传
    private void method_agreement_single_modify_upLoad(ArrayList<ArchivesManageFileVo> _archivesManageFileVoList) {

//        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()//
//                .setType(MultipartBody.FORM);//
        //不是做上传，是为了做日志上传用的
//        ArrayList<String> addLogList = new ArrayList<>();

//        if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
//            for (HashMap<String, Object> hashMapItem : fileSingleUpLoadFiles_upLoad_hashMap) {
//
//                String imageLocalPath = (String) hashMapItem.get(Parameterkey.file_path_server);
//
//                if (!TextUtils.isEmpty(imageLocalPath)) {
//
////                    File file = new File(imageLocalPath);
////                    multipartBodyBuilder.addFormDataPart(Parameterkey.files, file.getName(),//
////                            RequestBody.create(file, MediaType.parse(ApiService.MEDIATYPE_IMAGE_JPG)));//
////                    addLogList.add(imageLocalPath);
//                }
//            }
//        } else {
//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "itchen---->添加报修的图片地址 fileSingleUpLoadFiles_upLoad_hashMap 是空的");
//        }

        //接口文档传递参数；
//        {
//               "amount": "250000",
//                "archiveNo": "",
//                "archiveTypeId": "1",
//                "archivesManageFileVoList": [
//            {
//                "filePath": "null/20230818/2023081816083899456384.jpg"
//            }
//],
//                "brandModel": "",
//                "carBrand": "",
//                "partyA": "陈琪",
//                "signingDate": "2023-08-31",
//                "vehicleId": 30
//        }

//        {
//                "amount":"123456",
//                "archiveNo":"",
//                "archiveTypeId":"1",
//                "archivesManageFileVoList":[
//            {
//                "filePath":"null/20230819/2023081915064408016637.jpg"
//            },
//            {
//                "filePath":"null/20230819/2023081915064428513555.jpg"
//            },
//            {
//                "filePath":"null/20230819/2023081915064441759318.jpg"
//            }
//	           ],
//            "brandModel":"",
//                "carBrand":"",
//                "partyA":"陈大陈",
//                "signingDate":"2023-10-26",
//                "vehicleId":null
//        }

        //        ArchiveUpdateType
//                UPDATETYPE_1("1","整体修改"),
//                UPDATETYPE_2("2","只修改客户信息"),
//                UPDATETYPE_3("3","只修改附件"),
//                UPDATETYPE_4("4","只修改合同"),
//                UPDATETYPE_5("5","只修改车辆信息");

        //仅仅做参数上传addlog用；
        HashMap<String, Object> map = new HashMap<>();
//        map.put(Parameterkey.vehicleId, vehicleId_upLoad);//外侧大范畴的，车辆档案id
        map.put(Parameterkey.vehicleId, informationId_upLoad);//外侧大范畴的，车辆档案id

        map.put(Parameterkey.archivesId, archivesId_upLoad);//此合同的id
        map.put(Parameterkey.amount, amount_upLoad);//合同金额
        map.put(Parameterkey.archiveTypeId, archiveTypeId_upLoad);//合同类型
        map.put(Parameterkey.signingDate, signingDate_upLoad);//签约时间
        map.put(Parameterkey.partyA, partyA_upLoad);//合同的签约人
        map.put(Parameterkey.archiveNo, "");//合同编号-没有填写合同编号的地方，只能填充空值；
        map.put(Parameterkey.carBrand, "");//车辆品牌
        map.put(Parameterkey.brandModel, "");//车辆-车型
        map.put(Parameterkey.archivesManageFileVoList, _archivesManageFileVoList);//仅仅做日志上传
        map.put(Parameterkey.vehicleType, ArchiveUpdateType.UPDATETYPE_4.getIndex());//仅仅是修改合同

        //将来可能用
//        map.put(Parameterkey.brandId, brandId_upLoad);//车辆品牌
//        map.put(Parameterkey.seriesId, seriesId_upLoad);//车系ID
//        map.put(Parameterkey.carName, carName_upLoad);//车型
        //============================================================================================================
        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_ADDARCHIVESMANAGE_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.addArchivesManage_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);//仅仅有提交参数的能力

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .updateArchivesManage(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                        MediaType.parse(ApiService.HEADER_JSON)))
                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

                        method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);

                    }
                }).subscribe(new Consumer<String>() {
                    @Override
                    public void accept(String stringValue) throws Throwable {

                        //TipDialog.show(StringUtils.getString(R.string.add_submit_success), WaitDialog.TYPE.SUCCESS);
                        CommUtils.checkMaterialDialog(materialDialog);

                        //通知 大范畴的 档案详情刷新；
                        EventArchiveDetail eventArchiveDetail = new EventArchiveDetail();
                        eventArchiveDetail.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_ARCHIVEFILE_DETAIL);
                        EventBus.getDefault().post(eventArchiveDetail);

                        //如果是编辑进来的:即是从详情 的【编辑】进来的，那也也要刷新 合同详情
                        if (extra_archivesmanage_vo_is_edit) {
                            EventAgreeMentDetail eventAgreeMentDetail = new EventAgreeMentDetail();
                            eventAgreeMentDetail.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_AGREEMENT_DETAIL);
                            EventBus.getDefault().post(eventAgreeMentDetail);
                        }

                        //该页面关闭，
                        //提示提交成功，然后1秒后关闭界面
                        methodSubmitSuccess(AgreenMentAddSubmitActivity.this, new DoSomeThingListener() {
                            @Override
                            public void doSomeThing() {
                                methodBack();
                            }
                        });

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        //retain
                        CommUtils.checkMaterialDialog(materialDialog);

                    }
                });

    }

    //获取合同类型
    private void gainContractType(GainDataCallBackListener _gainDataCallBackListener) {

        HashMap<String, Object> map = new HashMap<>();
//        map.put(Parameterkey.carBrandId, _carBrandId);

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETLISTBYTYPE);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.getListByType_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
//                .getListByType(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
//                        MediaType.parse(ApiService.HEADER_JSON)))
                .getListByType(Parameterkey.vehicle_archive_type)
                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArrayList<ArchiveType>>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                    }
                })).subscribe(new Consumer<ArrayList<ArchiveType>>() {
                    @Override
                    public void accept(ArrayList<ArchiveType> archiveTypes) throws Throwable {

                        if (mDataResources_archiveTypeList_forPopu != null && !mDataResources_archiveTypeList_forPopu.isEmpty()) {
                            mDataResources_archiveTypeList_forPopu.clear();
                        }

                        if (archiveTypes != null && !archiveTypes.isEmpty()) {

                            for (ArchiveType archiveType : archiveTypes) {
                                EvaluateWadeInfo evaluateWadeInfo = new EvaluateWadeInfo();
                                evaluateWadeInfo.setDictCode(archiveType.getValue());//前端需要上传给后台的
                                evaluateWadeInfo.setDictLabel(archiveType.getName());

                                if (mDataResources_archiveTypeList_forPopu != null) {
                                    mDataResources_archiveTypeList_forPopu.add(evaluateWadeInfo);
                                }

                            }
                        }

                        //做一次转换为了做合同弹窗的
                        if (_gainDataCallBackListener != null) {
                            _gainDataCallBackListener.doSomeThing();
                        }

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                    }
                });

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode != RESULT_OK) {
            return;
        }

        if (requestCode == REQUEST_CODE_CHOOSE) {

            // 如果是在预览界面点击了确定
            if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) {

                // 获取选择的数据
                ArrayList<MultiMedia> selected = MultiMediaSetting.obtainMultiMediaResult(data);

//                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--selected--的值内容-->" + selected);

                if (selected == null) {
                    return;
                }

                // 循环判断，如果不存在，则删除
                for (int i = mplimageListInAgreenMent.getImagesAndVideos().size() - 1; i >= 0; i--) {

                    int k = 0;

                    for (MultiMedia multiMedia : selected) {
                        if (!mplimageListInAgreenMent.getImagesAndVideos().get(i).equals(multiMedia)) {
                            k++;
                        }
                    }

                    if (k == selected.size()) {
                        // 所有都不符合，则删除
                        mplimageListInAgreenMent.removePosition(i);
                    }

                }

            } else {

                List<LocalFile> result = MultiMediaSetting.obtainLocalFileResult(data);

                ArrayList<String> listUpLoad = new ArrayList<>();


                for (LocalFile localFile : result) {

                    // 绝对路径,AndroidQ如果存在不属于自己App下面的文件夹则无效
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult id:" + localFile.getId());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 绝对路径:" + localFile.getPath());
                    ///storage/emulated/0/middlelow/IMAGE_20230404_155336703.jpg
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图路径:" + localFile.getOldPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图路径:" + localFile.getOriginalPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult Uri:" + localFile.getUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图Uri:" + localFile.getOldUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图Uri:" + localFile.getOriginalUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 文件大小: " + localFile.getSize());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频音频长度: " + localFile.getDuration());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 是否选择了原图: " + localFile.isOriginal());

//                    if (localFile.isImageOrGif()) {
//                        if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        } else if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        }
//                    } else if (localFile.isVideo()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频类型");
//                    } else if (localFile.isAudio()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 音频类型");
//                    }
//
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 具体类型:" + localFile.getMimeType());

                    // 某些手机拍摄没有自带宽高，那么我们可以自己获取
//                    if (localFile.getWidth() == 0 && localFile.isVideo()) {
//
//                        MediaExtraInfo mediaExtraInfo = MediaUtils.getVideoSize(getApplication(), localFile.getPath());
//                        localFile.setWidth(mediaExtraInfo.getWidth());
//                        localFile.setHeight(mediaExtraInfo.getHeight());
//                        localFile.setDuration(mediaExtraInfo.getDuration());
//
//                    }
//
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 宽高: " + localFile.getWidth() + "x" + localFile.getHeight());
                    //method_single_image_addSubmit_upLoad(localFile.getPath());

                    if (!TextUtils.isEmpty(localFile.getPath())) {
                        listUpLoad.add(localFile.getPath());
                    }

                }

                //添加上传的内容的，间隔500毫秒上传一个；
                //数据的对象
                Observable<String> dataA = Observable.fromIterable(listUpLoad).subscribeOn(AndroidSchedulers.mainThread());
                //时间的对象,给N秒时间，因为要处理 3 个接口
                Observable<Long> timeB = Observable.interval(ConstantApi.UPLOAD_TIME_INTERVAL, TimeUnit.MILLISECONDS).subscribeOn(AndroidSchedulers.mainThread());
                //合并
                mCompositeDisposable.add(Observable.zip(dataA, timeB, new BiFunction<String, Long, String>() {

                            @Override
                            public String apply(String sValueUpLoadFilter, Long aLong) throws Throwable {

//                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "转换之后的地址是--aLong-->" + aLong);
//                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "转换之后的地址是-->" + sValueUpLoadFilter);

                                return sValueUpLoadFilter;
                            }
                        }).subscribeOn(AndroidSchedulers.mainThread())//
                        .observeOn(AndroidSchedulers.mainThread())//
                        .subscribe(new Consumer<String>() {
                            @Override
                            public void accept(String sValueUpLoad) throws Throwable {

                                method_single_image_addSubmit_upLoad(result.size(), sValueUpLoad);

                            }
                        }, new Consumer<Throwable>() {
                            @Override
                            public void accept(Throwable throwable) throws Throwable {
                                if (throwable != null) {
//                                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "执行了获取报错--->" + throwable.getMessage());
                                }
                            }
                        }));


//                LogUtils.d(ConstantSign.LOGCAT_NOMAL, "执行了--addLocalFileStartUpload---addLocalFileStartUpload---addLocalFileStartUpload");
                mplimageListInAgreenMent.addLocalFileStartUpload(result);

            }
        }


    }

    private void method_single_image_addSubmit_upLoad(int result_image_size, String _filePathLocal) {

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.file, _filePathLocal);//

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_UPLOADACCESSORY_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.uploadAccessory_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(false);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        //上传的是文件：
        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()//
                .setType(MultipartBody.FORM);//

        File filUpLoad = new File(_filePathLocal);

        if (filUpLoad != null) {
            //是单个的文件，只需要添加一个即可
            multipartBodyBuilder.addFormDataPart(Parameterkey.imageFile, filUpLoad.getName(),//
                    RequestBody.create(filUpLoad, MediaType.parse(ApiService.MEDIATYPE_IMAGE_JPG)));//
        }

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                //.uploadSingle(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue), MediaType.parse(ApiService.HEADER_JSON)))
                .uploadAccessory(multipartBodyBuilder.build())
                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<FileSingleUpLoadBean>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                        CommUtils.checkMaterialDialog(materialDialog);

                        //如果上传报错，提示报错信息
                        if (!TextUtils.isEmpty(serverMessage)) {
                            ToastUtils.showShort(serverMessage);
                        }

                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "添加上传图片的接口---响应的-->" + _filePathLocal);

                        if (materialDialog == null) {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);
                        }

//                        int percentage = 0;// 百分比
//                        if (_multiMediaView != null) {
//                            //percentage
//                        }

                    }
                }).subscribe(new Consumer<FileSingleUpLoadBean>() {
                    @Override
                    public void accept(FileSingleUpLoadBean fileSingleUpLoadBean) throws Throwable {

//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "添加上传图片的接口--响应的数据-->" + fileSingleUpLoadBean.getFileName());

                        if (fileSingleUpLoadBean != null) {

//                            {
//                                "code":"20000",
//                                    "data":{
//                                        "largeUrlSuffix":"",
//                                        "smallUrlSuffix":"",
//                                        "url":"http://222.222.17.184:8990/resource/null/20230831/2023083109001118761910.jpg",
//                                        "urlPrefix":"http://222.222.17.184:8990/resource/",
//                                        "urlSuffix":"null/20230831/2023083109001118761910.jpg"
//                                  },
//                                "message":"success"
//                            }

                            // : 2023-04-04 填充真实的图片的路径和name
                            FileUpLoad fileUpLoad = new FileUpLoad();
                            fileUpLoad.setFilePath(fileSingleUpLoadBean.getUrlSuffix());
//                            fileUpLoadManageCheckRecord.setFileName(fileSingleUpLoadBean.getFileName().substring(//
//                                    fileSingleUpLoadBean.getFileName().lastIndexOf("/") + 1));

                            //直接 存储
                            HashMap<String, Object> hashMapTemp = new HashMap<String, Object>();
                            hashMapTemp.put(Parameterkey.fileId, "");
                            hashMapTemp.put(Parameterkey.file_name, CommUtils.valueStringSplit(_filePathLocal));
                            hashMapTemp.put(Parameterkey.file_path_local, _filePathLocal);
                            hashMapTemp.put(Parameterkey.file_path_server, fileSingleUpLoadBean.getUrlSuffix());
                            hashMapTemp.put(Parameterkey.file_url_server, fileSingleUpLoadBean.getUrl());
                            hashMapTemp.put(Parameterkey.file_upload, fileUpLoad);

                            if (fileSingleUpLoadFiles_upLoad_hashMap != null) {
                                fileSingleUpLoadFiles_upLoad_hashMap.add(hashMapTemp);
                            }

                            method_test_upLoadHashMap();

                        }

                        //转换 一个 路径 ，如果到了最后一条就 关闭弹窗：
                        mCompositeDisposable.add(Observable.timer(result_image_size, TimeUnit.SECONDS)
                                .subscribeOn(AndroidSchedulers.mainThread())//
                                .observeOn(AndroidSchedulers.mainThread())//
                                .compose(AgreenMentAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                                .subscribe(new Consumer<Long>() {
                                    @Override
                                    public void accept(Long aLong) throws Exception {

//                                        LogUtils.d("itchen----即将执行 关闭弹窗处理--->" + TimeUtils.getNowString());
                                        CommUtils.checkMaterialDialog(materialDialog);
                                    }
                                }));

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        //图片上传失败；给提示
                        if (apiException != null) {
                            ToastUtils.showShort(apiException.getDisplayMessage());
                        }

                    }

                });


    }

    //列表 条目之中的对象；
    private void method_test_upLoadHashMap() {

        //startTime 为了标识是哪个对象的图片;
        for (HashMap<String, Object> hashMapItem : fileSingleUpLoadFiles_upLoad_hashMap) {
            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "对象->", hashMapItem);
        }

    }

    //是获取详情接口，填充 字段； 是在【编辑】的时候执行
    private void method_handler_detail(ArchivesManageVo _archivesManageVo) {

        //合同类型
        //-------------------------------------------------------------------------------------------------------------------
        //合同的类型选中名称
        //String archivesTypeName = _archivesManageVo.getArchivesTypeName();
        CommUtils.setText(textViewFileAgreenName, _archivesManageVo.getArchivesTypeName());

        //签约时间
        signingDate_upLoad = _archivesManageVo.getSigningDate();
        //String signingDate = _archivesManageVo.getSigningDate();
        CommUtils.setText(textViewAgreenTime, _archivesManageVo.getSigningDate());

        //合同签约人
        partyA_upLoad = _archivesManageVo.getPartyA();
        //String partyA = _archivesManageVo.getPartyA();
        CommUtils.setText(editViewNameAgreen, _archivesManageVo.getPartyA());

        //合同金额
        BigDecimal amount = _archivesManageVo.getAmount();
        String amountString = "";
        if (amount != null) {
            amountString = amount.toString();
        } else {
            amountString = CommUtils.formatComma2BigDecimal(0.00).toString();
        }
        amount_upLoad = amountString;

        CommUtils.setText(editViewPriceAmount, amountString);

        //-------------------------------------------------------------------------------------------------------------------
        //填充合同附件：单独的这个合同的附件；
        List<String> filePathList = _archivesManageVo.getFilePathList();
        if (filePathList != null && !filePathList.isEmpty()) {
            if (mplimageListInAgreenMent != null) {
                mplimageListInAgreenMent.setImageUrls(filePathList);
            }
        }

        List<ArchivesManageFileVo> archivesManageFileVoList = _archivesManageVo.getArchivesManageFileVoList();

        //填充现有的图片装载器；
        if (archivesManageFileVoList != null && !archivesManageFileVoList.isEmpty()) {

            for (ArchivesManageFileVo archivesManageFileVo_item : archivesManageFileVoList) {
//                 {
//                    "archivesId": 18,
//                    "createCustomerId": 4,
//                    "createTime": "2023-08-29 14:15:33",
//                    "fileId": 36,
//                    "filePath": "null/20230829/2023082914144445892870.png",
//                    "isDelete": 0,
//                    "url": "http://222.222.17.184:8990/resource/null/20230829/2023082914144445892870.png",
//                    "urlPrefix": "http://222.222.17.184:8990/resource/"
//            }
                //形式：
                String fileId = archivesManageFileVo_item.getFileId();
                //"filePath": "null/20230829/2023082914150560725478_750x750.jpg",
                String file_server_path = archivesManageFileVo_item.getFilePath();
                // "url": "http://222.222.17.184:8990/resource/null/20230829/2023082914150560725478_750x750.jpg",
                String file_server_url = archivesManageFileVo_item.getUrl();
                //2023082914150560725478_750x750.jpg
                String file_name = CommUtils.valueStringSplit(file_server_path);
                //String urlPrefix = archivesManageFileVo_item.getUrlPrefix();

                HashMap<String, Object> hashMap = new HashMap<>();
                //传递id
                hashMap.put(Parameterkey.fileId, fileId);

                if (!TextUtils.isEmpty(file_server_path)) {
                    hashMap.put(Parameterkey.file_path_server, file_server_path);
                }

                if (!TextUtils.isEmpty(file_server_url)) {
                    hashMap.put(Parameterkey.file_url_server, file_server_url);
                }

                if (!TextUtils.isEmpty(file_name)) {
                    hashMap.put(Parameterkey.file_name, file_name);
                }

                if (fileSingleUpLoadFiles_upLoad_hashMap != null) {
                    fileSingleUpLoadFiles_upLoad_hashMap.add(hashMap);
                }

            }

        }

        method_test_upLoadHashMap();
        //-------------------------------------------------------------------------------------------------------------------

        //合同类型的id
        archiveTypeId_upLoad = _archivesManageVo.getArchiveTypeId();
        String archiveTypeId = _archivesManageVo.getArchiveTypeId();

        //如果合同类型不是空，那么需要遍历 是哪个被选中；在这里调用接口？
        if (mDataResources_archiveTypeList_forPopu != null && !mDataResources_archiveTypeList_forPopu.isEmpty()) {

            for (EvaluateWadeInfo evaluateWadeInfo : mDataResources_archiveTypeList_forPopu) {
                String code = evaluateWadeInfo.getDictCode();
                if (!TextUtils.isEmpty(code) && !TextUtils.isEmpty(archiveTypeId)) {
                    if (TextUtils.equals(archiveTypeId, code)) {
                        evaluateWadeInfo.setChecked(true);
                    } else {
                        evaluateWadeInfo.setChecked(false);
                    }
                } else {
                    evaluateWadeInfo.setChecked(false);
                }
            }

        } else {

            gainContractType(new GainDataCallBackListener() {
                @Override
                public void doSomeThing() {

                    for (EvaluateWadeInfo evaluateWadeInfo : mDataResources_archiveTypeList_forPopu) {
                        String code = evaluateWadeInfo.getDictCode();
                        if (!TextUtils.isEmpty(code) && !TextUtils.isEmpty(archiveTypeId)) {
                            if (TextUtils.equals(archiveTypeId, code)) {
                                evaluateWadeInfo.setChecked(true);
                            } else {
                                evaluateWadeInfo.setChecked(false);
                            }
                        } else {
                            evaluateWadeInfo.setChecked(false);
                        }
                    }

                }
            });

        }

        //-------------------------------------------------------------------------------------------------------------------

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();

        if (basePopupView_agreeMentType != null) {
            basePopupView_agreeMentType.onDestroy();
            basePopupView_agreeMentType = null;
        }

        if (basePopupViewAgreenmentTime != null) {
            basePopupViewAgreenmentTime.onDestroy();
            basePopupViewAgreenmentTime = null;
        }

        if (mGlobalSetting != null) {
            mGlobalSetting.onDestroy();
        }

        if (fileSingleUpLoadFiles_upLoad_hashMap != null && !fileSingleUpLoadFiles_upLoad_hashMap.isEmpty()) {
            fileSingleUpLoadFiles_upLoad_hashMap.clear();
            fileSingleUpLoadFiles_upLoad_hashMap = null;
        }

        if (archivesManageVo_outSide != null) {
            archivesManageVo_outSide = null;
        }

        if (mDataResources_archiveTypeList_forPopu != null && !mDataResources_archiveTypeList_forPopu.isEmpty()) {
            mDataResources_archiveTypeList_forPopu.clear();
            mDataResources_archiveTypeList_forPopu = null;
        }


    }

    @Override
    protected void methodBack() {
        ActivityUtils.finishActivity(this);
    }

    @Override
    public void processExtraData() {

        Bundle extras_bundle = this.getIntent().getExtras();

        if (extras_bundle != null) {

            //flag_jumpfrom_where_type = extras_bundle.getString(ExtraKey.EXTRA_JUMPFROM_WHERE_TYPE);

            //携带车辆的档案id
            InformationManage extra_information_manage = extras_bundle.getParcelable(ExtraKey.EXTRA_INFORMATION_MANAGE);

            //携带这个合同的信息，目的是为了 获取 合同的详情，填充该页面静态内容；
//          ArchivesManageVo archivesManageVo_outSide = extras_bundle.getParcelable(ExtraKey.EXTRA_ARCHIVESMANAGE_VO);

            //携带 是【编辑】合同过来的；
            extra_archivesmanage_vo_is_edit = extras_bundle.getBoolean(ExtraKey.EXTRA_ARCHIVESMANAGE_VO_IS_EDIT);

            if (extra_information_manage != null) {

                //为了上传用:大范畴的 档案的 id
                informationId_upLoad = extra_information_manage.getInformationId();

            } else {

                //因为【编辑】此条合同的时候，要携带 档案的id,从合同条目过来的时候 我携带的是【档案id】
                //extra_bundle.putString(ExtraKey.EXTRA_VEHICLEID_ID, extra_information_manage.getVehicleId());
                informationId_upLoad = extras_bundle.getString(ExtraKey.EXTRA_VEHICLEID_ID);

            }


//            if (archivesManageVo_outSide != null) {
            //小范畴的-合同的id信息；
            archivesId_upLoad = extras_bundle.getString(ExtraKey.EXTRA_ARCHIVESMANAGEVO_ID);

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "是编辑合同过来的-id--extra_archivesmanage_vo_is_edit-->" + extra_archivesmanage_vo_is_edit);
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "单条合同的-id--archivesId_upLoad-->" + archivesId_upLoad);
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "该车辆档案的-id--informationId_upLoad-->" + informationId_upLoad);

//            }

        }
    }
}